home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
clib
/
sys
/
h
/
tty
< prev
next >
Wrap
Text File
|
1996-11-09
|
2KB
|
84 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/clib/sys/h/RCS/tty,v $
* $Date: 1996/11/06 22:01:41 $
* $Revision: 1.3 $
* $State: Rel $
* $Author: unixlib $
*
* $Log: tty,v $
* Revision 1.3 1996/11/06 22:01:41 unixlib
* Yet more changes by NB, PB and SC.
*
* Revision 1.2 1996/10/30 22:04:51 unixlib
* Massive changes made by Nick Burret and Peter Burwood.
*
* Revision 1.1 1996/04/19 21:23:56 simon
* Initial revision
*
***************************************************************************/
#ifndef __SYS_TTY_H
#define __SYS_TTY_H
#ifndef __TERMIO_H
#include <termio.h>
#endif
#define __TTY_STATIC_BUFS
#ifdef __TTY_STATIC_BUFS
/* #error static tty bufs not implemented completely */
#ifndef __SYS_PARAM_H
#include <sys/param.h>
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define MAXTTY 2
#define TTY_CON 0
#define TTY_423 1
struct tty
{
struct termio t[1];
struct winsize w[1];
int (*out)(int);
int (*in)(void);
int (*scan)(int);
int (*init)(void);
int (*flush)(void);
#ifdef __TTY_STATIC_BUFS
int sx,cx; /* screen x, character x */
int cnt; /* number of characters in input buffer */
char *ptr; /* read pointer in input buffer */
char buf[MAX_INPUT]; /* input buffer */
char del[MAX_INPUT]; /* number of displayed characters for character cx */
#else
char *buf, *ptr;
int cnt; /* number of characters in input buffer */
char *del;
int sx,cx; /* screen x, character x */
#endif
};
/* Note, the buf and del buffers are declared statically in the tty struct.
This is so that an exec'd process which shares the tty struct doesn't
free something allocated by the parent process. Such a call to free would
confuse the memory allocation system since the buffer wouldn't have been
allocated by that process but by the parent process. We could check the
address of the buffer agains __lomem and __break, but we might aswell
just live with the statically allocated memory compared to the extra code
we would need to have. Lazy, probably, but it works okay and only costs
MAXTTY * MAX_INPUT * 2 (= 1024 bytes in current implementation). */
#ifdef __cplusplus
}
#endif
#endif